//package com.van.bo.badwrting;
//
//import com.google.common.base.CaseFormat;
//import com.google.common.base.Converter;
//import org.apache.commons.lang3.StringUtils;
//import org.reflections.Reflections;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//
//import javax.swing.text.html.Option;
//import java.util.HashMap;
//import java.util.Map;
//import java.util.Optional;
//import java.util.Set;
//
//
///**
// * 利用
// * <dependency>
// * <groupId>org.reflections</groupId>
// * <artifactId>reflections</artifactId>
// * <version>0.9.12</version>
// * </dependency>
// * <dependency>
// * <groupId>com.google.guava</groupId>
// * <artifactId>guava</artifactId>
// * <version>30.1-jre</version>
// * </dependency>
// * reflections，guava，处理process中的白名单问题。
// */
////@Component
//public class ProcessAnnFieldHandler {
//
//    private static final Integer weakLogin = 1;
//    private static final Integer strongLogin = 2;
//
//    @Value("${process.package:none}")
//    private String scanProcessPackage = "com.van.bo.badwrting";
//
//    private static Map<String, Integer> whiteNameCache = new HashMap<>();
//
//    public static void main(String[] args) {
//        Converter<String, String> convert = CaseFormat.UPPER_CAMEL.converterTo(CaseFormat.LOWER_CAMEL);//UPPER_CAMEL,大写转小写驼峰
//        Reflections reflections = new Reflections("com.van.bo.badwrting");
//        Set<Class<?>> classes = reflections.getTypesAnnotatedWith(CustomForProcess.class);
//        for (Class<?> type : classes) {
//            CustomForProcess annotation = type.getAnnotation(CustomForProcess.class);
//            String value = annotation.value();
//            if (StringUtils.isBlank(value)) {//为配置processId，去类名小写
//                value = convert.convert(type.getSimpleName());
//            }
//
//            whiteNameCache.put(value, annotation.white());
//        }
//        System.out.println(whiteNameCache);
//    }
//
//    /**
//     * 获取代码中的白名单值
//     *
//     * @param processId action的processId
//     * @see CustomForProcess#white()
//     */
//    public static Integer getWhiteName(String processId) {
//        //throw new RuntimeException("failed to get white name");
//        return whiteNameCache.get(processId);
//    }
//}
